package com.xue.handler;

import com.xue.domain.AreaInfo;
import com.xue.geo.AreaControl;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import lombok.extern.slf4j.Slf4j;

/**
 * @author xue
 * @create 2022-09-19 9:54
 */
@Slf4j
@ChannelHandler.Sharable
public class AreaInfoHandler extends SimpleChannelInboundHandler<AreaInfo> {

    private final AreaControl areaControl = AreaControl.getInstance();

    @Override
    protected void channelRead0(ChannelHandlerContext ctx, AreaInfo msg) throws Exception {
        log.info("收到区域信息：{}", msg);
        areaControl.changeArea(msg);
    }

}
